package com.bzyd.mp.datascope.strategy;

import com.bzyd.mp.datascope.DataScopeParam;
import com.bzyd.mp.utils.UserContextUtil;
import net.sf.jsqlparser.expression.Expression;

/**
 * 只能查看自己的
 */
public class SelfDataScopeStrategy implements DataScopeStrategy {
    @Override
    public String mode() {
        return "self";
    }

    @Override
    public Expression buildWhere(Expression where, String mappedStatementId, DataScopeParam dataScopeParam) {
        return grantOwn(where, dataScopeParam, UserContextUtil.getCurrentUser());
    }
}
